package com.airforce.mappers;

import com.airforce.model.index_award;
import org.apache.ibatis.jdbc.SQL;

public class index_awardSqlProvider {

    public String insertSelective(index_award record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("index_award");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getAwardname() != null) {
            sql.VALUES("awardname", "#{awardname,jdbcType=VARCHAR}");
        }
        
        if (record.getAwardimg() != null) {
            sql.VALUES("awardimg", "#{awardimg,jdbcType=VARCHAR}");
        }
        
        if (record.getAwardprice() != null) {
            sql.VALUES("awardprice", "#{awardprice,jdbcType=DECIMAL}");
        }
        
        if (record.getPower() != null) {
            sql.VALUES("power", "#{power,jdbcType=DOUBLE}");
        }
        
        if (record.getCreatetime() != null) {
            sql.VALUES("createtime", "#{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.VALUES("updatetime", "#{updatetime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getSharebefore() != null) {
            sql.VALUES("sharebefore", "#{sharebefore,jdbcType=TINYINT}");
        }
        
        if (record.getFlag() != null) {
            sql.VALUES("flag", "#{flag,jdbcType=TINYINT}");
        }
        
        if (record.getOrders() != null) {
            sql.VALUES("orders", "#{orders,jdbcType=INTEGER}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(index_award record) {
        SQL sql = new SQL();
        sql.UPDATE("index_award");
        
        if (record.getAwardname() != null) {
            sql.SET("awardname = #{awardname,jdbcType=VARCHAR}");
        }
        
        if (record.getAwardimg() != null) {
            sql.SET("awardimg = #{awardimg,jdbcType=VARCHAR}");
        }
        
        if (record.getAwardprice() != null) {
            sql.SET("awardprice = #{awardprice,jdbcType=DECIMAL}");
        }
        
        if (record.getPower() != null) {
            sql.SET("power = #{power,jdbcType=DOUBLE}");
        }
        
        if (record.getCreatetime() != null) {
            sql.SET("createtime = #{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.SET("updatetime = #{updatetime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getSharebefore() != null) {
            sql.SET("sharebefore = #{sharebefore,jdbcType=TINYINT}");
        }
        
        if (record.getFlag() != null) {
            sql.SET("flag = #{flag,jdbcType=TINYINT}");
        }
        
        if (record.getOrders() != null) {
            sql.SET("orders = #{orders,jdbcType=INTEGER}");
        }
        
        sql.WHERE("id = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}